package com.agent.commons.config;

import com.agent.commons.yaml.MinIoYaml;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * MinIo配置类
 */
@Configuration
public class MinIOConfig {

    @Autowired
    private MinIoYaml minIoYaml;

    @Bean
    public MinioClient minioClient(){
        return MinioClient.builder()
                .endpoint(minIoYaml.getEndpoint())
                .credentials(minIoYaml.getAccessKey(),minIoYaml.getSecretKey())
                .build();
    }

}
